package com.demo.afternoon;

/**
 * @ClassName Test01
 * @Description TODO
 * @Author tianqinglong
 * @Date 14:14 2022/7/5
 * @Version 1.0
 **/
public class Test01 {
    public static void main(String[] args) {
        Child child = new Child(2,3,4);
        System.out.println(child.getSum());
    }
}
class Parent{
    private int x;
    private int y;

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public Parent(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public String toString() {
        return "Parent{" +
                "x=" + x +
                ", y=" + y +
                '}';
    }
}
class Child extends Parent{
    private int z;

    public int getZ() {
        return z;
    }

    public void setZ(int z) {
        this.z = z;
    }

    public Child(int x, int y, int z) {
        super(x, y);
        this.z = z;
    }
    public int getSum(){
        int x=getX();
        int y=getY();
        return x+y+z;
    }
}
